/*
 * ThreadDriveSequnce.h
 *
 *  Created on: Jan 31, 2013
 *      Author: Drew Prevost
 */

#ifndef THREADDRIVESEQUNCE_H_
#define THREADDRIVESEQUNCE_H_

#include "Tachometer.h"
#include "Protothread.h"
#include "ThreadMicroDelay.h"
#include "ThreadServoRate.h"

class ThreadDriveSequnce: public Protothread
{
public:
  ThreadDriveSequnce(
                     int nTachIrqNum,
                     int nTachIsrPin,
                     int nTachIsrMode,
                     int nServoClutchPin,
                     unsigned long nMaxServoClutchSpeedInMicrosPerDegree,
                     unsigned int nInitialClutchPosition,
                     unsigned int nInitialClutchRateInDegPerSec,
                     int nDegreeClutchUp,
                     int nRateClutchUp,
                     int nDegreeServoClutchDown,
                     int nRateServoClutchDown,
                     int nServoThrottlePin,
                     unsigned long nMaxServoThrottleSpeedInMicrosPerDegree,
                     unsigned int nInitialThrottlePosition,
                     unsigned int nInitialThrottleRateInDegPerSec,
                     int nDegreeThrottleHigh,
                     int nRateThrottleHigh,
                     int nDegreeThrottleDown,
                     int nRateThrottleDown,
                     int nSecondsFullThrottle,
                     int nSecondsIdle,
                     int nLoadWheelMinRpm );

  virtual ~ThreadDriveSequnce();

  virtual bool run();

protected:
  Tachometer tachLoadWheel;
  ThreadMicroDelay threadMicroDelay;
  ThreadServoRate servoClutch;
  ThreadServoRate servoThrottle;

  int nDegreeServoClutchDown;
  int nRateServoClutchDown;
  int nDegreeThrottleDown;
  int nRateThrottleDown;
  int nSecondsIdle;
  int nDegreeThrottleHigh;
  int nRateThrottleHigh;
  int nSecondsFullThrottle;
  int nDegreeClutchUp;
  int nRateClutchUp;
  int nLoadWheelMinRpm;
};

#endif /* THREADDRIVESEQUNCE_H_ */
